// import { pa } from 'element-plus/es/locale'
import { createRouter, createWebHistory } from 'vue-router'

const pages= import.meta.glob('../views/**/page.js',{
	eager:true,
	import:'default'
})
const components=import.meta.glob('../views/**/index.vue',{
	eager:true,
	import:'default'
})
const routes = Object.entries(pages).map(([path,meta])=>{
	// console.log(path,meta)
	const compPath=path.replace('page.js','index.vue')
	// console.log(compPath)
	path=path.replace('../views','').replace('page.js','')||'/'
	name=path.split('/').filter(Boolean).join('-')
	return {
		path,
		name,
		component:components[compPath],
		meta
	}
})
console.log(routes)
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
})

export default router
